package com.course.server.config;


import com.course.server.utils.CustomInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class HandleConfig implements WebMvcConfigurer {
//    @Bean
//    public CustomInterceptor customInterceptor() {
//        return new CustomInterceptor();
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        //注册拦截器到SpringMVC机制，返回 一个拦截器注册
//        InterceptorRegistration interceptorRegistration = registry.addInterceptor(customInterceptor());
//        //使用interceptorRegistration拦截器注册对象配置 映射路径
//        interceptorRegistration.addPathPatterns("/**");
//        // 放行
//        interceptorRegistration.excludePathPatterns("/admin/user/login");
//        interceptorRegistration.excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**","/swagger-ui.html#/**");
//
//    }
}
